package com.powernode.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.powernode.domain.ProdComm;
import com.powernode.mapper.ProdCommMapper;
import com.powernode.service.ProdCommService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
* ClassName:ProdCommServiceImpl
* Package:com.powernode.service.impl
* Description:
* @date:2025/2/2 15:09
* @author:bailihua
*/
@Service
public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> implements ProdCommService{
    @Autowired
    private ProdCommMapper prodCommMapper;


    @Override
    public Boolean replyAndExamineProdComm(ProdComm prodComm) {
        // 获取商品评论内容
        String replyContent = prodComm.getReplyContent();
        // 判断评论内容是否有值
        if (StringUtils.hasText(replyContent)) {
            prodComm.setReplyTime(new Date());
            prodComm.setReplySts(1);
        }
        return prodCommMapper.updateById(prodComm)>0;
    }
}
